package com.yckj.day02;

/**
 * TODO 赋值运算符、扩展赋值运算符、算术运算符
 *
 * @author shengyuee
 * @version 1.0
 * 2025/7/17 10:31
 */
public class Demo2 {
    public static void main(String[] args) {
        //任务：完成两数据的交换
        int temp = 0;
        int first = 20;
        int second = 10;
        System.out.println("交换前："+first+","+second);
        temp = first;
        first = second;
        second = temp;
        System.out.println("交换后："+first+","+second);
        // 扩展运算符
        int num = 40;
        num %= 3; // num = num % 3;
        System.out.println("num = " + num);
        // +作为字符串连接
        System.out.println('A'+12+"hello"+45);
        System.out.println("java"+'b'+12+45);
        // 减法
        System.out.println(1-0.9);
        // 数学计算/
       // System.out.println(3/0);
        System.out.println(3.0/0);
        System.out.println(3/2);
        System.out.println(2/-3);
        System.out.println(-2/3);
        System.out.println(-3/-2);
        System.out.println(10/0.0); //Infinity
        System.out.println(-10/0.0);//-Infinity
        System.out.println(-0/0.0);//NaN

         // %：数学计算
        //System.out.println(3%0);
        System.out.println(3.0%0);
        System.out.println(-3%-2);
        System.out.println(2%3);
        System.out.println(-3%2);
        System.out.println(2%-3);
    }
}
